<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="./css/list.css">
</head>
<body>
    <h2>这是商品列表...<a href="./cart.html">去结算</a></h2>
    <div class="cont">
        <!-- <div class="box" index="12312312">
            <img src="https://img10.360buyimg.com/n7/jfs/t1/109383/15/11613/242507/5e8c4c3dE901f4367/723da17587f13bb7.jpg" alt="">
            <p>电脑</p>
            <span>5999</span>
            <button class="add">加入购物车</button>
        </div> -->
    </div>
</body>
<script src="./js/jquery.js"></script>
<script>

    $.ajax({
        url:"./data/goods.json",
        success:(res)=>{
            res = JSON.parse(res)
            let str = "";
            res.forEach(val=>{
                str += `<div class="box" index="${val.proId}">
                            <a href="./detail.html?id=${val.proId}">
                                <img src="${val.url}" alt="">
                                <p>${val.name}</p>
                                <span>${val.price}</span>
                            </a>
                            <button class="add">加入购物车</button>
                        </div>`
            })
            $(".cont").html(str)
        }
    })

</script>
</html>